using System;
using CommandSystem;
using Exiled.API.Features;

namespace RgCore.Commands
{
    [CommandHandler(typeof(ClientCommandHandler))]
    public class DecisionCommand : ICommand
    {
        public static event Action<Player> PlayerAgree;

        public static event Action<Player> PlayerRefuse;

        public string Command => "v";

        public string[] Aliases => new string[] { "vote" };

        public string Description => "";

        public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
        {
            response = "";
            if (arguments.Count == 0)
                return false;
            if (arguments.At(0).ToLower() == "ty")
            {
                PlayerAgree?.Invoke(Player.Get(sender));
                return true;
            }
            else if (arguments.At(0).ToLower() == "fd")
            {
                PlayerRefuse?.Invoke(Player.Get(sender));
                return true;
            }
            return false;
        }
    }
}